Welcome to the exciting world of JavaScript Programming. Before you get started learning about JavaScript's bells and whistles, you probably have a number of questions. This section will address common JavaScript questions.
Among many other features, JavaScript provides for
You must also remember that Netscape and Microsoft do not support identical versions of the scripting language, nor equally-capable versions of the JavaScript object model. This can influence design and coding decisions when you sit down to write a script.
You can read more about JavaScript in the Netscape/Sun official press release and in Microsoft's announcement of JavaScript support for the Internet Explorer.
<H3>Greet the World</H3> <!-- Here's some Java Script --> <SCRIPT LANGUAGE="JavaScript"> document.write("Hello world!") </SCRIPT>This is how it looks when Netscape loads this HTML and JavaScript
Greet the World
<SCRIPT LANGUAGE="JavaScript"> <!-- hide from old browsers function hello_world() { document.write("<b>Hello World!</b><p>") } <!-- done hiding --></SCRIPT>
Java | JavaScript |
Java Programs must be compiled on a server machine before a client can run them. | JavaScript is interpreted; Netscape can understand JavaScript directives in HTML documents. |
Java is object-oriented. Java supports classes and inheritance | JavaScript is object-based. You can assign properties and methods to JavaScript objects. |
Java programs are kept in a special directories and files on the server machine. Programs are distinct and separate from HTML. | JavaScript is fully integrated with HTML. |
Java uses strong typing. Programmers must declare variable types in advance. | JavaScript uses weak typing. Variables are flexible and can contain any type of object. |
Java binds statically. All Object references must be defined at compile time. | JavaScript binds dynamically. References are checked at run time. |
<H3>My First JavaScript HTML Document</H3> <!-- Here's some Java Script--> <SCRIPT LANGUAGE="JavaScript"> document.write("This is my first JavaScript document!") </SCRIPT>